package com.ss.android.article.base.feature.detail2.a.a;

import android.view.View;

import com.bytedance.common.utility.Logger;
import com.bytedance.common.utility.UIUtils;
import com.ss.android.article.browser.R;
import com.ss.android.common.download.DownloadShortInfo;
import com.ss.android.common.util.ToolUtils;

final class d implements Runnable {
    private final AppAdViewHolder.a$a e;
    private final DownloadShortInfo a;
    private final int b;
    private final long c;
    private final long d;

    d(AppAdViewHolder.a$a arg1, DownloadShortInfo arg2, int arg3, long arg4, long arg6) {
        this.e = arg1;
        this.a = arg2;
        this.b = arg3;
        this.c = arg4;
        this.d = arg6;
    }

    public final void run() {
        int v4 = 8;
        if (this.a != null && this.a.id == this.e.a) {
            Logger.d("AppAdViewHolder", "mId = " + this.e.a + " info.id = " + this.a.id + " appName = " + this.e.b.l.appName);
            try {
                this.e.b.m = this.a;
                String v1 = "";
                String v0_1 = "";
                this.e.b.b.setVisibility(View.GONE);
                this.e.b.c.setVisibility(View.GONE);
                this.e.b.e.setVisibility(View.VISIBLE);
                this.e.b.h.setVisibility(View.VISIBLE);
                this.e.b.f.setVisibility(View.GONE);
                if (this.b == 1) {
                    v1 = android.support.design.a.a(this.c) + "/" + android.support.design.a.a(this.d);
                    v0_1 = this.e.b.k.getString(com.ss.android.article.browser.R.string.kf);
                    UIUtils.setMaxLines(this.e.b.d, R.drawable.af);
                    this.e.b.d.setTextColor(this.e.b.k.getColor(com.ss.android.article.browser.R.color.cz));
                } else if (this.b == 2) {
                    v1 = android.support.design.a.a(this.c) + "/" + android.support.design.a.a(this.d);
                    v0_1 = this.e.b.k.getString(com.ss.android.article.browser.R.string.ki);
                    UIUtils.setMaxLines(this.e.b.d, R.drawable.ag);
                    this.e.b.d.setTextColor(this.e.b.k.getColor(com.ss.android.article.browser.R.color.d1));
                } else if (this.b == 3) {
                    this.e.b.f.setVisibility(View.VISIBLE);
                    this.e.b.h.setVisibility(View.GONE);
                    if (this.e.b.m.b == 16) {
                        v1 = android.support.design.a.a(this.d);
                        v0_1 = this.e.b.k.getString(com.ss.android.article.browser.R.string.kh);
                        UIUtils.setMaxLines(this.e.b.d, R.drawable.ag);
                        this.e.b.d.setTextColor(this.e.b.k.getColor(com.ss.android.article.browser.R.color.d1));
                    } else if (this.e.b.m.b == v4) {
                        if (!ToolUtils.d(this.e.b.j, this.e.b.m.fileName)) {
                            v0_1 = this.e.b.k.getString(com.ss.android.article.browser.R.string.k9);
                        } else if (!android.support.design.a.isTextEmpty(this.e.b.l.btnTxt)) {
                            v0_1 = this.e.b.l.btnTxt;
                        } else {
                            v0_1 = this.e.b.k.getString(com.ss.android.article.browser.R.string.ke);
                        }

                        this.e.b.d.setTextColor(this.e.b.k.getColor(com.ss.android.article.browser.R.color.cx));
                        UIUtils.setMaxLines(this.e.b.d, R.drawable.ae);
                        v1 = android.support.design.a.a(this.d);
                    }

                    this.e.b.e.setVisibility(View.GONE);
                }

                if (this.d > 0) {
                    this.e.b.e.setProgress(((int) (this.c * 100 / this.d)));
                } else {
                    this.e.b.e.setProgress(0);
                }

                if (this.e.b.h.getVisibility() == View.VISIBLE) {
                    this.e.b.i.setText(((CharSequence) v1));
                    this.e.b.d.setText(((CharSequence) v0_1));
                }

                if (this.e.b.f.getVisibility() != View.VISIBLE) {
                    return;
                }

                this.e.b.g.setText(((CharSequence) v1));
                this.e.b.d.setText(((CharSequence) v0_1));
            } catch (Exception v0) {
                v0.printStackTrace();
            }
        }
    }
}

